#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

void prin(const complex<double>&);

int main()
{
    int a, b;
    int c, d;
    cout<< "Enter first number Re: ";
    cin>> a;
    cout<< "Enter first number Jm: ";
    cin>> b;

    cout<< "Enter second number Re: ";
    cin>> c;
    cout<< "Enter second number Jm: ";
    cin>> d;

    complex<double> c1(a, b);
    complex<double> c2(c, d);
    complex<double> c3 = c1 + c2;

    cout << "c1: ", prin(c1);
    cout << "c2: ", prin(c2);
    cout << "c1 + c2: ", prin(c3);

    return 0;
}

void prin(const complex<double>& c)
{
    bool positive = c.imag() > 0;
    cout << c.real() << (positive ? " + " : " - ") << fabs(c.imag()) << "i" << endl;// Функция fabs возвращает абсолютное значение своего аргумен-

}
